<template>
        <form>
            <form-group-input placeholder="请输入账号" :key="`${keyword}Text`" v-model="username">
            </form-group-input>
            <form-group-password placeholder="请输入密码" :key="`${keyword}Password`" v-model="password">
            </form-group-password>
            <form-group-submit :disabled="isDisabledSubmit" :btn-text="submitButtonText" @click="$emit('submit',username,password)">
            </form-group-submit>
        </form>
</template>

<script>
import FormGroupInput from './FormGroupInput'
import FormGroupPassword from './FormGroupPassword'
import FormGroupSubmit from './FormGroupSubmit'

export default {
    name:'CardForm',
    components:{
        FormGroupInput,
        FormGroupPassword,
        FormGroupSubmit
    },
    props: {
                submitButtonText: {
                    default: '提交'
                },
                keyword:{
                    default:''
                }
            },
            data: function () {
                return {
                    username: '',
                    password: ''
                }
            },
            computed: {
                isDisabledSubmit:function(){
                    return this.username.length == 0 || this.password.length == 0
                }
            }
}
</script>